import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'mybutton.dart';
import 'main.dart';

void main() => runApp(RegisterPageStatelessWidget());

class RegisterPageStatelessWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "注册页面",
      debugShowCheckedModeBanner: false,
      theme: ThemeData(primarySwatch: Colors.blue),
      home: new RegisterPageStatefulWidget(),
    );
  }
}

class RegisterPageStatefulWidget extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return new RegisterPageState();
  }
}

class RegisterPageState extends State {
  var _userPassController = new TextEditingController();
  var _userPassController2 = new TextEditingController();
  var _userNameController = new TextEditingController();

  void _login() {
    var string = _userPassController.toString();
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: new SafeArea(
          child: Column(
        children: <Widget>[
          Container(
            child: Padding(
                padding: EdgeInsets.only(top: 45),
                child: FlatButton.icon(
                    onPressed: null,
                    icon: Icon(Icons.arrow_back,color: Color(0xff303133),),
                    label: Text(
                      '注册',
                      style:
                          TextStyle(fontSize: 24,color: Color(0xff303133)),
                    ))),
            alignment: Alignment.topLeft,
          ),
          Container(
            padding: EdgeInsets.only(left: 30, right: 20),
            child: Column(
              children: <Widget>[
                Padding(
                  padding: EdgeInsets.only(top: 90.0),
                  child: TextField(
                    enabled: true,
                    controller: _userNameController,
                    decoration: new InputDecoration(
                        contentPadding: EdgeInsets.only(bottom: 5),
                        labelText: "手机号",
                        hintText: "请输入手机号"),
                    keyboardType: TextInputType.phone,
                  ),
                ),
                Padding(
                  padding: EdgeInsets.only(top: 34.0),
                  child: TextField(
                    obscureText: true,
                    controller: _userPassController,
                    decoration: new InputDecoration(
                        contentPadding: EdgeInsets.only(bottom: 5),
                        labelText: "密码",
                        hintText: "请输入用户密码"),
                  ),
                ),

                Padding(
                  padding: EdgeInsets.only(top: 34.0),
                  child: TextField(
                    obscureText: true,
                    controller: _userPassController2,
                    decoration: new InputDecoration(
                        contentPadding: EdgeInsets.only(bottom: 5),
                        labelText: "确认密码",
                        hintText: "请输入确认密码"),
                    keyboardType: TextInputType.visiblePassword,
                  ),
                ),
                Padding(
                  padding: EdgeInsets.only(top: 100),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.stretch,
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                      FlatButton(
                        padding: EdgeInsets.only(top: 10, bottom: 10),
                        onPressed: _login,
                        color: Color(0xff3C98FF),
                        child: Text(
                          '注册',
                          style: TextStyle(color: Colors.white, fontSize: 18),
                        ),
                        shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(22.5)),
                      )
                    ],
                  ),
                ),
              ],
            ),
            alignment: Alignment.center,
          )
        ],
      )),
    );
  }
}
